home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / lbot_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2009-11-03  |  5.8 KB  |  164 lines

  1.  
  2. function units_lbot_alien_setup()
  3.     units_setup(4,true,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_SMALLROBOTALIENSHADOW)
  4. end
  5.  
  6. function units_lbot_alien_resetup()
  7.     units_setup(4,true,nil,ENET_EFFECT_GEOMETRY_SMALLROBOTALIENSHADOW)
  8. end
  9.  
  10. function units_lbot_alien_select()
  11.     units_select(12,1)
  12. end
  13.  
  14. function units_lbot_alien_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_lbot_alien_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_lbot_alien_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_lbot_alien_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_lbot_alien_explode()
  31.     units_explode_small1_green()
  32. end
  33.  
  34. function units_lbot_alien_move()
  35.     local unit = uniGetExecutor()
  36.     local sound = unit:play3DSound("smallrobot_move.wav",1)
  37.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.8))
  38.     local steps = {}
  39.     local stepsmoke = {}
  40.     local i = 0;
  41.     for i = 0,1 do
  42.         steps[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_WHEELSTEPSEMITTER)
  43.         stepsmoke[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE5)
  44.  
  45.     end
  46.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  47.     for i = 0,1 do
  48.         if(unit:getScale() < 1.0) then 
  49.             steps[i]:destroy()
  50.         else
  51.             steps[i]:setTransformOwner()
  52.             steps[i]:suspendedDestroy(70)
  53.         end
  54.             stepsmoke[i]:suspendedDestroy(5)
  55.     end
  56.     sound:destroy()
  57. end
  58.  
  59. function units_lbot_alien_fire()
  60.     local unit = uniGetExecutor()
  61.     if (unit:getTransformOwner() ~= nil) then
  62.         local carrier = unit:getTransformOwner():getTransformOwner()
  63.         while(carrier:getCurrentCommandUID() < 2000000000) do pause() end
  64.         waitDeath(carrier:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI,uniGetTarget()))
  65.     else
  66.         waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI,uniGetTarget()))
  67.     end
  68.     uniSetLife(uniGetLife() / 3.0)
  69.     local gn = unit:getBone(ENBT_GUNNEST)
  70.     local firespot = gn:getBone(ENBT_FIRE1)
  71.     waitDeath(gn:aimGun(0,MATH_PI / 3.0,uniGetTarget()))
  72.     local i = 0
  73.     for i = 0,2 do
  74.         gn:play3DSound("smallrobot_fire.wav",0):destroy()
  75.         local shot1 = firespot:addBulletEffect(ENET_EFFECT_BULLET_GREENLASERBOLT)
  76.         shot1:executeCommand(ENC_FIRE1)
  77.         gn:gunRecoil(0,0.1,4)
  78.         pause(0.1)
  79.     end
  80.     unit:addFireArrow()
  81. end
  82.  
  83. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_MOVE,"units_lbot_alien_move")
  84. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_FIRE1,"units_lbot_alien_fire")
  85. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_FIRE2,"units_lbot_alien_fire")
  86. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_SELECT,"units_lbot_alien_select")
  87. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_SELECTENEMY,"units_lbot_alien_selectenemy")
  88. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_UNSELECT,"units_lbot_alien_unselect")
  89. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_SETUP,"units_lbot_alien_setup")
  90. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_RESETUP,"units_lbot_alien_resetup")
  91. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_DAMAGED,"units_lbot_alien_damaged")
  92. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_EXPLODE,"units_lbot_alien_explode")
  93. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_HIGHLIGHT,"units_lbot_alien_highlight")
  94. registerCommand(ENSCRIPTSET_SMALLROBOT_ALIEN,ENC_INSIDE,"units_inside")
  95.  
  96. -- make description of unit
  97. desc = getEffectDescriptionP(ENET_UNIT_SMALLROBOT_ALIEN)
  98. desc.ClassID = ENCLASS_MESHINSTANCE
  99. desc.EffectClassType = ENECT_GEOMETRY
  100. desc.FileName = "smallrobot_alien.rmd"
  101. desc.ScriptSet = ENSCRIPTSET_SMALLROBOT_ALIEN
  102. desc.MoveType = ENMOVE_GROUNDORIENTED
  103. desc.RenderType = ENRENDERTYPE_GEOMETRY
  104. desc.Material = ENMAT_RIGIDSKINNEDMESH
  105. desc.MaterialColors = units_materialcolors_human
  106.  
  107. -- shadow
  108. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_SMALLROBOTALIENSHADOW)
  109. desc.ClassID = ENCLASS_MESHINSTANCE
  110. desc.EffectClassType = ENECT_GEOMETRY
  111. desc.FileName = "smallrobot_alien_shadow.rmd"
  112. desc.RenderType = ENRENDERTYPE_SHADOW
  113. desc.Material = ENMAT_SHADOW
  114. desc.MaterialColors = units_materialcolors_shadow
  115.  
  116. -- register new unit to logic
  117. unitDesc = logic_getUnitDescP(13)
  118. unitDesc.group = 0
  119. unitDesc.order = 0
  120. unitDesc.unit_res_id = ENET_UNIT_SMALLROBOT_ALIEN
  121. unitDesc.unit_icon_id = "Smallrobot_a_small_normal.dds"
  122. unitDesc.active_id = "Smallrobot_a_small_active.dds"
  123. unitDesc.pressed_id = "Smallrobot_a_small_pressed.dds"
  124. unitDesc.big_icon_id = "Smallrobot_a_big_normal.dds"
  125. unitDesc.small_icon_id = "Smallrodot_l_stats.dds"
  126. unitDesc.HP = 4
  127. unitDesc.MP = 10
  128. unitDesc.WR = 1
  129. unitDesc.min_WR = 1
  130. unitDesc.WD = 1
  131. unitDesc.WR2 = 0
  132. unitDesc.min_WR2 = 0
  133. unitDesc.WD2 = 0
  134. unitDesc.ability = 0
  135. unitDesc.transport = 0
  136. unitDesc.value = 1
  137. unitDesc.race = 1
  138. unitDesc.fire_pause = 0.2
  139. unitDesc.move_pause = 0.5
  140. unitDesc.unit_info_scale = 0.08
  141. unitDesc.scn_name = "LBOTA"
  142.  
  143. ------------------------------------------------------------------------------------------------------
  144. ------------------------ effects related to unit------------------------------------------------------
  145. ------------------------------------------------------------------------------------------------------
  146.  
  147. function bullets_greenlaserbolt_fire()
  148.     local bullet = uniGetExecutor()
  149.     bullet:setTransformOwner()
  150.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_GREENLASERBOLTFLY)
  151.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_GREENLASERBOLT)
  152.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,400,uniGetTarget()),1000)
  153.     light:destroy()
  154.     track:destroy()
  155.     local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_GREENLASERBOLTHIT)
  156.     pause(0.2)
  157.     hit_ps:suspendedDestroy(1.0)
  158.     uniGetTarget():executeCommand(ENC_DAMAGED)
  159.     pause(1.0)
  160.     bullet:destroy()
  161. end
  162.  
  163. registerCommand(ENSCRIPTSET_BULLET_GREENLASERBOLT,ENC_FIRE1,"bullets_greenlaserbolt_fire")
  164.